package edu.zut.cs.software.cms.module.student.domain;

import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import com.fasterxml.jackson.annotation.JsonIgnore;

import edu.zut.cs.software.cms.base.domain.BaseTreeEntity;

/**
 * 
 * @author 任雪燕
 *
 *Student's upper level
 */

@Entity
@Table(name = "T_STUDENT_AREA")
@NamedQueries({ @NamedQuery(name = "StudentArea.getRoot", query = "select m from StudentArea m where m.parent is null") })
public class StudentArea extends BaseTreeEntity<StudentArea, Long>{
	
    /**
	 * 
	 */
	private static final long serialVersionUID = 8336083347311590461L;

	/**
     * The department to which the student belong
     */
	@Column
	String department;
	
	/**
	 * Student's major
	 */
	@Column
	String major;
	
	/**
	 * The clazz to which the student belong
	 */
	@Column
	String clazz;
	
	/**
	 * one StudentArea relate to Many students.
	 */
	@OneToMany(mappedBy = "studentArea", cascade = CascadeType.REMOVE, fetch = FetchType.EAGER)
	@JsonIgnore
	List<Student> students;

	public String getDepartment() {
		return department;
	}

	public void setDepartment(String department) {
		this.department = department;
	}

	public String getMajor() {
		return major;
	}

	public void setMajor(String major) {
		this.major = major;
	}

	public String getClazz() {
		return clazz;
	}

	public void setClazz(String clazz) {
		this.clazz = clazz;
	}

	public List<Student> getStudents() {
		return students;
	}

	public void setStudents(List<Student> students) {
		this.students = students;
	}

	public static long getSerialversionuid() {
		return serialVersionUID;
	}
	

}
